package com.niiwoo.civet.scheduler.trigger;

import com.alibaba.dubbo.config.annotation.Reference;
import com.alibaba.dubbo.rpc.RpcContext;
import com.niiwoo.civet.user.service.UserAuthOperatorDubboService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;


/**
 * 第三方授权相关定时任务
 *
 * @author zzl
 * @date 2017/11/25 17:18
 */
@Component
public class ThirdAuthJobTrigger {
    private static final Logger logger = LoggerFactory.getLogger(ThirdAuthJobTrigger.class);

    @Reference(version = "1.0.0")
    private UserAuthOperatorDubboService userAuthOperatorDubboService;

    @Scheduled(cron = "${auth.notify-user-re-auth}")
    public void notifyUserForAuthTimeoutJob() {
        logger.info("N分钟内未获取通话记录，发送通知提醒用户重新授权notifyUserForAuthTimeoutJob");
        userAuthOperatorDubboService.notifyUserForAuthTimeout();
    }

    @Scheduled(cron = "${auth.cancel-bid}")
    public void returnProjectForAuthTimeout() {
        logger.info("N分钟内未获取通话记录，系统自动审核并退回借款标returnProjectForAuthTimeout");
        userAuthOperatorDubboService.returnProjectForAuthTimeout();
    }

}